package defpackage; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import cn.wps.core.runtime.Platform; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.main.local.filebrowser.search.network.AssistantBean; import cn.wps.moffice_eng.R; import com.appsflyer.AppsFlyerProperties; import com.google.firebase.analytics.FirebaseAnalytics; import com.iflytek.cloud.SpeechConstant; import com.iflytek.cloud.SpeechUtility; import com.mopub.mobileads.VastExtensionXmlManager; import defpackage.ghu; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONObject; /* renamed from: gjy reason: default package */ public final class gjy { private static String hev = "https://wpsqa.wps.cn/api/qa/match"; public static List<ghu> R(String str, int i) { try { JSONObject jSONObject = new JSONObject(); if (i == 1) { jSONObject.put("count", 4); } jSONObject.put("question", str); jSONObject.put(AppsFlyerProperties.CHANNEL, OfficeApp.arx().arB()); jSONObject.put("appVersion", OfficeApp.arx().getString(R.string.app_version)); jSONObject.put(SpeechConstant.LANGUAGE, Platform.getLanguageCode()); jSONObject.put("packageName", OfficeApp.arx().getPackageName()); JSONObject jSONObject2 = new JSONObject(lwd.c(hev, jSONObject.toString(), null)); if (!"ok".equalsIgnoreCase(jSONObject2.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { return null; } String optString = jSONObject2.optString(FirebaseAnalytics.Param.CONTENT); if (TextUtils.isEmpty(optString)) { return null; } JSONArray jSONArray = new JSONArray(optString); ArrayList arrayList = new ArrayList(); for (int i2 = 0; i2 < jSONArray.length(); i2++) { JSONObject jSONObject3 = jSONArray.getJSONObject(i2); String optString2 = jSONObject3.optString("question"); String optString3 = jSONObject3.optString("answer"); String optString4 = jSONObject3.optString(VastExtensionXmlManager.TYPE); String optString5 = jSONObject3.optString("qid"); if ("url".equals(optString4) && !TextUtils.isEmpty(optString2) && !TextUtils.isEmpty(optString3) && !TextUtils.isEmpty(optString5)) { AssistantBean assistantBean = new AssistantBean(optString5, optString2, optString3, optString4); ghu ghu = new ghu(); ghu.gEV = 5; ghu.extras = new ArrayList(); ghu.extras.add(new ghu.a("object", assistantBean)); ghu.extras.add(new ghu.a("keyword", str)); ghu.extras.add(new ghu.a(NotificationCompat.CATEGORY_STATUS, Integer.valueOf(i))); arrayList.add(ghu); } } return arrayList; } catch (Exception e) { e.printStackTrace(); return null; } } }